<?
include('/www/resellers_advanced/login/wallet_db.html');
//translate########################################################################
$databse_error=translate('error');
$no_sld=translate('no_sld');
$no_tld=translate('no_tld');
$no_user_id=translate('no_user_id');
$no_return_url=translate('no_return_url');
$registrant_info=translate('registrant_info');
$domain_tbl=translate('domain_tbl');
$expiration_d=translate('expiration_d');
$dns_tbl=translate('dns_tbl');
$buton_back=translate('buton_back');
$buton_next=translate('buton_next');
$firstname=translate('firstname');
$lastname=translate('lastname');
$organizationname=translate('organizationname');
$job_title=translate('job_title');
$e_mail=translate('e_mail');
$address_tbl=translate('address_tbl');
$city_tbl=translate('city_tbl');
$state_tbl=translate('state_tbl');
$zip_tbl=translate('zip_tbl');
$country_tbl=translate('country_tbl');
$phone_tbl=translate('phone_tbl');
$fax_tbl=translate('fax_tbl');
$no_clients=translate('no_clients');
$select_user=translate('select_user');
$enter_sld=translate('enter_sld');
$enter_tld=translate('enter_tld');
//translate#######################################################################
if (isset($_POST[form_submit]) && $_POST[form_submit]='yes') {
	$url = "https://supremeserver1.com/resellers/u/registerdomain/index.php?";
	$data[action] = "changedetails";
	$data[user_id] = $_POST[user_id];
	$data[sld] = $_POST[sld];
	$data[tld] = $_POST[tld];
	$data[return_url] = $_POST[return_url];


	if(!$sld = $data[sld]) exit("$no_sld");
	if(!$tld = $data[tld]) exit("$no_tld");
	if(!$user_id = $data[user_id]) exit("$no_user_id");
	if(!$return_url = $data[return_url]) exit("$no_return_url");

        //-----------------------------------------------------
	$sql['type'] = "SELECT";
	$sql['params'] = "rd.id,rd.flags,rd.sld,rd.tld,rd.registrantaddress1,rd.registrantaddress2,rd.registrantcity,rd.registrantcountry,rd.registrantemailaddress,rd.registrantfax,rd.registrantfirstname,rd.registrantlastname,rd.registrantjobtitle,rd.registrantorganizationname,rd.registrantphone,rd.registrantpostalcode,rd.registrantstateprovince,rd.registrantstateprovincechoice,rd.numyears,rd.unlockregistrar,rd.renewname,rd.domainpassword,rd.ns1,rd.ns2,p.expire_date";
	$sql['table'] = "registerdomain rd,purchases p";
	$sql['where'] = "rd.sld='".$sld."' and rd.tld='".$tld."' and rd.purchase_id = p.purchase_id and p.client_id='".$user_id."'";
	$sql['options'] = "";
	$sql['return'] = "hash";
	//------------------------------------------------------
	if(!$data=sql_exec($sql,$dbh81,'assoc')) {
		exit("$database_error");
	}
		echo "
		<form action='https://supremeserver1.com/resellers/u/registerdomain/' method='POST'>
		<table width='90%' class='bTable' cellpadding=0 cellspacing=0>
		<tr>
			<th align='left' colspan='2'>$registrant_info:</th>
		</tr>
		<tr>
			<td align='right'>$domain_tbl:</td>
			<td  align='left'><b>".($data[sld].".".$data[tld])."</b></td>
		</tr>
		<tr>
			<td align='right'>$expiration_d:</td>
			<td  align='left'>".$data[expire_date]."</b></td>
		</tr>
		  <tr>
		    <td align='right'>$dns_tbl 1 :</td>
		    <td><input size='40' type='text' name='ns1' value='".$data[ns1]."'    ></td>
		  </tr>
		  <tr>
		    <td align='right'>$dns_tbl 2 :</td>
		    <td><input size='40' type='text' name='ns2' value='".$data[ns2]."'    ></td>
		  </tr>
		  </tr>
			<td colspan='4' align='center'>
				<input type='hidden' name='sld' value='".$data[sld]."'>
				<input type='hidden' name='tld' value='".$data[tld]."'>
				<input type='hidden' name='user_id' value='".$user_id."'>
				<input type='hidden' name='return_url' value='".$return_url."'>
				<input type='hidden' name='action' value='changedetails_set_dns'>
				<input type='button' value='$buton_back' class='buttonNormal' id='Back' onClick='window.history.back();'>&nbsp;
				<input type='submit' class='buttonNormal' id='Forward' value='$buton_next'>
			</td>
		    </tr>
		</table>
		</form>
		<br>
		<form action='$baseURL/u/registerdomain/' method='POST'>
		<table width='90%' class='bTable' cellpadding=0 cellspacing=0>
		<tr>
			<th align='left' colspan='2'>$registrant_info :</th>
		</tr>
		  <tr>
		    <td align='right'>$firstname :</td>
		    <td><input type='text' name='registrantfirstname' disabled_ value='".$data[registrantfirstname]."'    ></td>
		  </tr>
		  <tr>
		    <td align='right'>$lastname :</td>
		    <td><input type='text' name='registrantlastname' disabled_ value='".$data[registrantlastname]."'></td>
		  </tr>
		  <tr>
		    <td align='right'>$organizationname :</td>
		    <td><input type='text' name='registrantorganizationname' disabled_  value='".$data[registrantorganizationname]."'    ></td>
		  </tr>
		  <tr>
		    <td align='right'>$job_title :</td>
		    <td><input type='text' name='registrantjobtitle' disabled_  value='".$data[registrantjobtitle]."'    ></td>
		  </tr>
		  <tr>
		    <td align='right'>$e_mail :</td>
		    <td><input type='text' name='registrantemailaddress'  disabled_   value='".$data[registrantemailaddress]."'    ></td>
		  </tr>
		  <tr>
		    <td align='right'>$address_tbl :</td>
		    <td><input type='text' name='registrantaddress1'  disabled_ value='".$data[registrantaddress1]."'    ></td>
		  </tr>
		  <tr>
		    <td align='right'>&nbsp;</td>
		    <td><input type='text' name='registrantaddress2'  disabled_ value='".$data[registrantaddress2]."'    ></td>
		  </tr>
		  <tr>
		    <td align='right'>$city_tbl :</td>
                            <td><input type='text' name='registrantcity'  disabled_  value='".$data[registrantcity]."'    ></td>
                          </tr>
                          <tr>
                            <td align='right'>$state_tbl :</td>
                            <td><input type='text' name='registrantstateprovince'  disabled_ value='".$data[registrantstateprovince]."'  ></td>
                          </tr>
                          <tr>
                            <td align='right'>$zip_tbl :</td>
                            <td><input type='text' name='registrantpostalcode'  disabled_  value='".$data[registrantpostalcode]."'  ></td>
                          </tr>
                          <tr>
                            <td align='right'>$country_tbl :</td>
                            <td>
                                <select name='registrantcountry'  disabled>";
                                        echo get_countries($data[registrantcountry]);
                                echo "</select>
                            </td>
                          </tr>
                          <tr>
                            <td align='right'>$phone_tbl :</td>
                            <td><input type='text' name='registrantphone'  disabled_ value='".$data[registrantphone]."'    ></td>
                          </tr>
                          <tr>
                          <tr>
                            <td align='right'>$fax_tbl :</td>
                            <td><input type='text' name='registrantfax'  disabled_ value='".$data[registrantfax]."'    ></td>
                          </tr>
                                <td colspan='4' align='center'>
                                        <input type='hidden' name='sld' value='".$data[sld]."'>
                                        <input type='hidden' name='tld' value='".$data[tld]."'>
                                        <input type='hidden' name='user_id' value='".$user_id."'>
                                        <input type='hidden' name='return_url' value='".$return_url."'>
                                        <input type='hidden' name='action' value='changedetails_set'>
                                        <input type='button' value='$buton_back' class='buttonNormal' id='Back' onClick='window.history.back();'>&nbsp;
                                        <input type='submit' class='buttonNormal' id='Forward' value='$buton_next'>
                                </td>
                            </tr>

                        </table>";


} else {
	//-----------------------------------------------------
        $sql['type'] = "SELECT";
        $sql['params'] = "client_id, username, firstname, lastname";
        $sql['table'] = "clients";
        $sql['where'] = "reseller_id='$id' AND blocked=0";
        $sql['options'] = "ORDER BY username";
        $sql['return'] = "struct";
        //------------------------------------------------------
        if (!$result=sql_exec($sql,$dbh81,'assoc')) {
                exit($no_clients);
        }
        foreach ($result as $value) {
                $clients[$value[client_id]]=$value[username];
        }
	$params[sid] = $sid;
	$params[action] = 'changedetails';
	$action_url = "$baseURL/$webDIR/?".encode_params($params);
	$return_url=$action_url;
	echo "<table class='bTable' cellspacing=0>
	<form action=\"$action_url\" method=POST>
	<tr>
		<th align=left>$select_user :</th>
		<th align=left>$enter_sld :</th>
		<th align=left>$enter_tld :</th>
	</tr>
	<tr>
		<td><select name=user_id>
			<option value=''>-----------</option>\n";
		foreach ($clients as $key => $value) {
			echo "<option value='$key'>$value</option>\n";
		}
		echo "</select></td>
		<td><input type='text' name='sld' value='$_POST[sld]' size=15 maxlength=20></td>
		<td><select name=tld>
				<option value='com'>.com</option>
                                <option value='net'>.net</option>
                                <option value='org'>.org</option>
                                <option value='biz'>.biz</option>
                                <option value='us'>.us</option>
                                <option value='info'>.info</option>
		</select></td>
	</tr>
	<tr>
		<td colspan=3 align=center><input type='submit' name='submit' value='$buton_next'>
			<input type='hidden' name='return_url' value='$return_url'>
			<input type='hidden' name='form_submit' value='yes'></td>
	</tr>
	</form>
	</table>";

}
?>
